package com.mybed.crm.result;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mybed.crm.common.enums.HttpCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 封装分页查询结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageResult<T> extends ResultP implements Serializable {

    private long total; //总记录数
    private List<T>  rows; //当前页数据集合
    private String params=null;
    public  void insertData(IPage iPage){
        total=iPage.getTotal();
        rows=iPage.getRecords();
        setCode(HttpCodeEnum.SUCCESS.getCode());
        setMsg(HttpCodeEnum.SUCCESS.getErrorMessage());
    }
}
